package com.eascs.admin.o2o.back.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eascs.admin.o2o.back.dao.O2oBackDao;
import com.eascs.admin.o2o.back.entity.O2oBackEntity;
import com.eascs.admin.o2o.back.vo.O2oBackPageVo;
import com.eascs.app.dao.PageResult;

@Service
public class O2oBackService {

	@Autowired
	O2oBackDao backDao;
	
	/**
	 * @Description:
	 *               <p>
	 *               分页查询代偿分期记录
	 *               </p>
	 */
	public PageResult<Object[]> getByPage(O2oBackPageVo vo){
		return backDao.getByPage(vo);
	}
	
	
	public int isnert(O2oBackEntity backEntity){
		return backDao.insert(backEntity);
	}
	
	public int update(O2oBackEntity backEntity){
		return backDao.updateById(backEntity);
	}
	
	public O2oBackEntity getEntityById(String id){
		return backDao.getById(O2oBackEntity.class, id);
	}
	
	public O2oBackEntity getEntityByLoanNo(String loanApllyNo){
		String sql = "select * from o2o_compensatory_back where loan_apply_no = ? ";
		return backDao.findEntity(sql, O2oBackEntity.class, loanApllyNo);
	}
	
	public List<O2oBackEntity> getEntityByLoanApplyNo(String loanapplyNo){
		return backDao.getEntityByLoanApplyNo(loanapplyNo);
	}
	
	public int getCountByLoanApplyNo(String loanapplyNo){
		return backDao.getCountByLoanApplyNo(loanapplyNo);
	}
	
	public int getCountPlan(String mainId){
		return backDao.getCountPlan(mainId);
	}
	
	public PageResult<Object[]> getO2oBackEntitys(String loanapplyNo){
		return backDao.getO2oBackEntitys(loanapplyNo);
	}
}
